package com.dy.details.controller;

import com.dy.details.service.ConfirmOrderService;
import com.dy.placeOrder.ConfirmOrder;
import com.kaoshi.common.config.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("address")
@CrossOrigin
public class ConfirmOrderController {
    @Autowired
    private ConfirmOrderService confirmOrderService;

    @RequestMapping("findDetailByOid")
    public Result<ConfirmOrder> findDetailByOid(@RequestParam Long oid) {
        ConfirmOrder confirmOrder = confirmOrderService.findDetailByOid(oid);
        if (confirmOrder != null) {
            return Result.ok(confirmOrder);
        } else {
            return Result.ok(); // 或者返回 Result.fail("未找到订单详情")
        }
    }
}
